var viewer = new Cesium.Viewer("cesiumViewer", {
    animation: false,
    fullscreenButton: false,
    timeline: false,
    projectionPicker: true,
});

var scene = viewer.scene;
scene.debugShowFramesPerSecond = true;
scene.requestRenderMode = true;
scene.scene3DOnly = true;

var camera = scene.camera;

// camera.constrainedAxis = new Cesium.Cartesian3(0, 0, 1);
// camera.defaultLookAmount = Cesium.Math.PI / 200;
// camera.defaultMoveAmount = 1000000.0;
// camera.defaultRotateAmount = Cesium.Math.PI / 20;

var entitys = [];

for (var i = 0; i < 2; i++) {

    var et = viewer.entities.add({
        position: Cesium.Cartesian3.fromDegrees(113 + 2 * i, 36, 0.0),
        cylinder: {
            length: 200000.0,
            topRadius: 150000.0,
            bottomRadius: 150000.0,
            outline: true,
            outlineColor: Cesium.Color.WHITE,
            outlineWidth: 4,
            material: Cesium.Color.fromRandom({
                alpha: 1.0
            })
        }
    });

    entitys.push(et);
}

function test(){
    camera.flyHome();
}

function testFrustum(){
    camera.frustum.far = 20000000;
    camera.frustum.near = 10000000;
    
}

function testLook(){
    camera.look(Cesium.Cartesian3.UNIT_Z);
}

function testMove(){
    // camera.moveLeft();
    camera.moveForward();
    // var r = camera.right;
    // camera.move(new Cesium.Cartesian3(r.x, r.y, r.z)); // error
}
function testRotate(){
    camera.rotate(Cesium.Cartesian3.UNIT_Z);
}

function testDirection(){
    // 效果不好控制 一般不要使用
    camera.direction = new Cesium.Cartesian3(0, 0, 1);
}

function testSwitch(){
    camera.switchToOrthographicFrustum(); // 正交相机
    //camera.switchToPerspectiveFrustum();    // 透视相机
}

function testTwist(){
    camera.twistLeft();
}

function testZoom(){
    //camera.zoomIn();
    camera.zoomOut();
}